home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / id5-lu48-en.txt < prev    next >
Encoding:
Text File  |  1999-05-29  |  26.3 KB  |  683 lines

  1.  
  2.         ---------------------------------------------------
  3.         -------    Immortal Descandants CrackMe 5.0 ----------
  4.         ------- by TORN@DO, tutorial by Lucifer48 ---------
  5.         ---------------------------------------------------
  6.  
  7. I apologize for my english, i'am french ;) This translation was difficult.
  8. (i'am looking for a dictionnary... mail me the url, if you know one!)
  9. Nice read!
  10.  
  11. =========================================
  12. 1. INTRODUCTION - PART 1/2 - NAME OF FILE
  13. =========================================
  14.  
  15. It is the first thing to know. I have two solutions:
  16.  
  17. The first (the more simple) is using filemon:
  18. we obtain the following result:
  19.  
  20. 197    20:13:44    Idcrkme5    Open    C:\REGISTRATION.DAT    NOTFOUND    OPENEXISTING OPENALWAYS
  21. 198    20:13:44    Idcrkme5    Open    C:\REGISTRATION.DAT    NOTFOUND    OPENEXISTING OPENALWAYS
  22.  
  23. Another (better) method, which will allow us to get the name and enter in the code.
  24. Into soft-ice, i put a BPX CreateFileA, we are here:
  25.  
  26. XXXX:00409B1B  PUSH EAX                          ;80000000 (GENERIC_READ)
  27. XXXX:00409B1C  MOV  EBP,[KERNEL32!CreateFileA]
  28. XXXX:00409B22  PUSH ECX                          ;REGISTRATION.DAT
  29. XXXX:00409B23  CALL EBP                          ;CALL [KERNEL32!CreateFileA]
  30. XXXX:00409B25  CMP  EAX,-01                      ;EAX=-1 : file not found
  31. XXXX:00409B28  MOV  EBP,EAX                      ;handle of file
  32. XXXX:00409B2A  JNZ  00409B48
  33.  
  34. So, i create the file REGISTRATION.DAT, and we can continue in 00409B48.
  35.  
  36. =============================================
  37. 2. INTRODUCTION - PART 2/2 - LOST IN THE CODE
  38. =============================================
  39.  
  40. XXXX:00409B48  PUSH EBP                          ;save handle of file
  41. XXXX:00409B49  CALL [KERNEL32!GetFileType]
  42. XXXX:00409B4F  TEST EAX,EAX
  43. XXXX:00409B51  JNZ  00409B76
  44. XXXX:00409B53  PUSH EBP                          ;handle of file
  45. XXXX:00409B54  CALL [KERNEL32!CloseHandle]       ;close the file
  46. ...it is not the right way, to succeed in this crackme, we must escape KERNEL32!CloseHandle
  47.  
  48. Then, we are in a call (where, i don't know), somewhere in vc++ compiled code, the crackme
  49. does something (well it's not important for the moment). After "few ^p ret" (F12 key), 
  50. everything appears clearly:
  51.  
  52.  
  53. XXXX:00401ABE  PUSH  0040D724                     ;datas
  54. XXXX:00401AC3  PUSH  ECX
  55. XXXX:00401AC4  CALL  004053C0                     ;we exit from here
  56. XXXX:00401AC9  ADD   ESP,08                       ;pop-pop
  57. XXXX:00401ACC  MOV   ESI,EAX
  58. XXXX:00401ACE  TEST  ESI,ESI                      ;if REGISTRATION.DAT don't exist ESI=0
  59. XXXX:00401AD0  JZ    00401B76                     ;going to 00401B76 isn't a good idea
  60.  
  61. [...]
  62. few lines... read the keyfile; etc. etc.
  63. [...]
  64.  
  65. XXXX:00401B6A  XOR  EAX,EAX                       ;here, we are in a wrong way
  66. XXXX:00401B6C  POP  EDI
  67. XXXX:00401B6D  POP  ESI
  68. XXXX:00401B6E  POP  EBX
  69. XXXX:00401B6F  ADD  ESP,00000864                  ;wow! pop-pop-...-pop-pop
  70. XXXX:00401B75  RET
  71. XXXX:00401B76  MOV  EAX,00000001
  72. XXXX:00401B7B  POP  EDI
  73. XXXX:00401B7C  POP  ESI
  74. XXXX:00401B7D  POP  EBX
  75. XXXX:00401B7E  ADD  ESP,00000864                  ;wow! pop-pop-...-pop-pop
  76. XXXX:00401B84  RET
  77.  
  78. We are now in the main procedure (call):
  79.  
  80. XXXX:00401B92  CALL 00401A30                      ;<--- WE WERE HERE
  81. XXXX:00401B97  ADD  ESP,04                        :pop-pop
  82. XXXX:00401B9A  PUSH 00
  83. XXXX:00401B9C  CALL 00401340
  84. XXXX:00401BA1  ADD  ESP,04                        ;pop-pop
  85. XXXX:00401BA4  PUSH 00
  86. ...
  87. XXXX:00401BFE  CALL 00401DC0
  88. XXXX:00401C03  ADD  ESP,04                        ;pop-pop
  89. XXXX:00401C06  TEST EAX,EAX
  90. XXXX:00401C08  JZ   00401D18                      ;we mustn't jump
  91. XXXX:00401C0E  PUSH 00
  92. XXXX:00401C10  CALL 00401A30
  93. XXXX:00401C15  ADD  ESP,04                        ;pop-pop
  94. XXXX:00401C18  TEST EAX,EAX
  95. XXXX:00401C1A  JZ   00401D18                      ;no, no jump :)
  96. XXXX:00401C20  PUSH 00
  97. XXXX:00401C22  CALL 00401E90
  98. ...
  99. there are 17 call to explore (to see), to arrive at the end, it is always the same thing:
  100.     push  00
  101.     call  x
  102.     add   esp,04
  103.     test  eax,eax
  104.     j(n)z bad_keyfile
  105. ...
  106. XXXX:00401CFE  CALL 00403190
  107. XXXX:00401D03  ADD  ESP,04
  108. XXXX:00401D06  TEST EAX,EAX
  109. XXXX:00401D08  JZ   00401D18                     ;no!
  110. XXXX:00401D0A  MOV  EAX,[ESP+04]
  111. XXXX:00401D0E  PUSH EAX
  112. XXXX:00401D0F  CALL 004012E0                     ;yeah!, we have a good keyfile
  113. XXXX:00401D14  ADD  ESP,04                       ;pop-pop
  114. XXXX:00401D17  RET
  115. XXXX:00401D18  MOV  EAX,[ESP+04]
  116. XXXX:00401D1C  PUSH EAX
  117. XXXX:00401D1D  CALL 00401290                     ;our keyfile isn't good!
  118. XXXX:00401D22  ADD  ESP,04                       ;pop-pop
  119. XXXX:00401D25  RET
  120.  
  121. We know our job, exploring these 17 call (thanks Torn@do) to produce a good keyfile
  122. It is now that the crackme begins.
  123.  
  124.  
  125. ================================================
  126. 3. PART 01/17 - CALL 00401DC0 (en XXXX:00401BFE)
  127. ================================================
  128.  
  129. Each call is built is on same way, i won't explain the beginning of the call (check if the
  130. keyfile exists... etc. etc). Interessing things (made by Torn@do) are located at the end of
  131. the call. Let's go:
  132.  
  133. XXXX:00401E56  PUSH EAX                          ;bytes from our keyfile
  134. XXXX:00401E57  CALL 00405240                     ;length of the keyfile
  135. XXXX:00401E5C  ADD  ESP,10
  136. XXXX:00401E5F  MOV  EBX,EAX                      ;EBX = length of keyfile
  137. ...
  138. XXXX:00401E6A  SUB  EBX,00000400                 ;400h = 1024d
  139. XXXX:00401E70  POP  EDI
  140. XXXX:00401E71  POP  ESI
  141. XXXX:00401E72  CMP  EBX,01
  142. XXXX:00401E75  SBB  EAX,EAX                      ;substract 1 if and only if carry (CF=1)
  143. XXXX:00401E77  POP  EBX
  144. XXXX:00401E78  NEG  EAX                          ;NEG FFFFFFFF = 00000001
  145. XXXX:00401E7A  ADD  ESP,00000800
  146. XXXX:00401E80  RET                               ;end of call 00401DC0
  147.  
  148. To bypass this call, we must have a keyfile with a length of 1024 bytes.
  149.  
  150. Remark: we look (more deeply) at the call which computes the length of the keyfile:
  151.                     (example, a keyfile with 4 bytes)
  152. REGISTRATION.DAT    31 32 33 34       the call 00405240 gives EAX=00000004
  153. REGISTRATION.DAT    31 1A 33 34       the call 00405240 gives EAX=00000001
  154. REGISTRATION.DAT    31 0D 0A 34       the call 00405240 gives EAX=00000003
  155.                                       (each 0D is deleted)
  156.  
  157. So i create my keyfile with 1024 bytes.
  158.  
  159. ================
  160. 4. THE SURPRISE!
  161. ================
  162.  
  163. VERSION 1:
  164. ----------
  165. I restart the crackme, then...surprise!!! **boom** i receive an error (page fault).
  166. After few try, i discover that if the keyfile is more than 188 bytes, then we get a page fault,
  167. otherwise, no error.
  168. At the beginning, i REALLY thought it was a bug! i mailed Torn@do to ask him, he answered me
  169. there were no bug.
  170. I really thought there was a bug, until the moment i decided to locate (to look after) the error.
  171.  
  172. XXXX:00401B92  CALL 00401A30
  173. XXXX:00401B97  ADD  ESP,04                        :pop-pop
  174. XXXX:00401B9A  PUSH 00
  175. XXXX:00401B9C  CALL 00401340                      ;PAGE FAULT HERE!
  176. XXXX:00401BA1  ADD  ESP,04                        ;pop-pop
  177.  
  178. In fact, the stack is filled we our keyfile (i saw it later...) and, as i want to bypass this
  179. call (without error of course), i put the right adress of the call  00401340 (that's 00401BA1)
  180. in my keyfile. At this moment i tought, it was thought by Torn@do (it's a good idea).
  181.  
  182. At the end of the call 00401340 (after the instruction add esp,20), if we do a d ESP, we see
  183. we are "in the middle" of the keyfile (but xor'ed, for me it's 67)
  184. And: 00401340 XOR 67676767 = 67277427
  185.  
  186. 000000B0 ?? ?? ?? ?? ?? ?? ?? ??-?? 67 27 74 27 ?? ?? ??    .........g't'...
  187.  
  188. No more page fault, we continue.
  189.  
  190. VERSION 2: The version 1 isn't the right method, because the crackme was expected a nul byte
  191. ---------- (we don't have to put the adress of come back of this call in the keyfile, it is a
  192.            mistake). Read the next chapter, to understand what i mean.
  193.  
  194.  
  195. ================================================
  196. 5. PART 02/17 - CALL 00401A30 (en XXXX:00401C10)
  197. ================================================
  198.  
  199. At the beginning, i thought this call weren't important, and i discovered that it was the place
  200. where the name (in the message box "request") was built.
  201.  
  202. ...
  203. XXXX:00401B3A  NOT  ECX
  204. XXXX:00401B3C  DEC  ECX                           ;length of our "name area"
  205. XXXX:00401B3D  XOR  BL,CL                         ;BL is a char from the keyfile
  206. XXXX:00401B3F  MOV  ECX,FFFFFFFF
  207. XXXX:00401B44  SUB  EAX,EAX
  208. XXXX:00401B46  MOV  [EDX+0040D186],BL             ;save the char xor'ed
  209. ...
  210.  
  211. Example with my name, i want to write "Lucifer48"
  212.  
  213. 00000090 ?? ?? ?? ?? ?? ?? ?? ??-?? p1 p2 p3 p4 p5 p6 p7    ................
  214. 000000A0 p8 p9 00 ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??    ................
  215.  
  216. We MUST put a null byte after this "name area". Each character is xor'ed with the length of the
  217. name (for me 9). So, Lucifer48 become : 45 7C 6A 60 6F 6C 7B 3D 31.
  218.  
  219. The byte 00 is very very very important, at the beginning i hadn't put it, and later, the
  220. crackme use this null byte (REPNZ SCASB). So i experienced (encountered) many probems (with the
  221. stack) For me, the length of "name area" was 67h!!!
  222.  
  223. The icon of the crackme (upper left corner) is always the same...
  224.  
  225. ================================================
  226. 6. PART 03/17 - CALL 00401E90 (en XXXX:00401C22)
  227. ================================================
  228.  
  229. XXXX:00401F47  MOV  DL,[EAX+0040D0F0]             ;at start: EAX=0
  230. XXXX:00401F4D  CMP  [EAX+ESP+38],DL               ;compare with a byte in the keyfile
  231. XXXX:00401F51  JNZ  00401F73                      ;if not equal, we exit
  232. XXXX:00401F53  MOV  DWORD PTR [0040D0B4],00000001 ;a new icon!
  233. XXXX:00401F5D  INC  CX
  234. XXXX:00401F5F  CMP  CX,09
  235. XXXX:00401F63  JLE  00401F44
  236. XXXX:00401F65  MOV  EAX,00000001                  ;if we are here, it is ok.
  237. ...
  238. XXXX:00401F72  RET
  239.  
  240. We put in the keyfile the 10 bytes wanted by the crackme. So:
  241.  
  242. 00000000 06 0A 15 07 13 10 0A 72-0C 00 ?? ?? ?? ?? ?? ??    .......r........
  243.  
  244. We finished this call, the icon skeleton's head ;)
  245.  
  246. ================================================
  247. 7. PART 04/17 - CALL 00401F80 (en XXXX:00401C34)
  248. ================================================
  249.  
  250. We must exit the call with EAX=0
  251.  
  252. XXXX:0040210C  MOV  DWORD PTR [0040D0B4],00000002 ;still a new icon
  253. XXXX:00402116  XOR  EAX,EAX
  254. XXXX:00402118  POP  EBP
  255. XXXX:00402119  POP  EDI
  256. XXXX:0040211A  POP  ESI
  257. XXXX:0040211B  POP  EBX
  258. XXXX:0040211C  ADD  ESP,00000800
  259. XXXX:00402122  RET                                ;end of call 00401F80
  260.  
  261. Before, few 'xor' with a part of our keyfile, it's very easy to understand.
  262. To get eax=0, we must validate few comparasions:
  263. (CMP BL,53 / CMP EAX,6F / CMP ECX,66 / CMP EDX,70 / CMP ESI,49 / CMP EDI,43 / CMP EBP,45)
  264. In the keyfile:
  265.  
  266. 00000000 ** ** ** ** ** ** ** **-** ** 07 20 34 3E 09 07    ........... 4>..
  267. 00000010 0A ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??    ................
  268.  
  269. Remark: if you haven't understand yet, "**" means that this byte is already known (found)
  270. in a previous call (see above), and the "??" is a unknown byte.
  271.  
  272. The new icon is a cross!
  273.  
  274.  
  275. ================================================
  276. 8. PART 05/17 - CALL 00402130 (en XXXX:00401C46)
  277. ================================================
  278.  
  279. We must exit the call with EAX=1.
  280.  
  281. XXXX:00402241  MOV  DWORD PTR [0040D0B4],00000003 ;a new icon
  282. XXXX:0040224B  MOV  EAX,00000001
  283. XXXX:00402250  POP  EBP
  284. XXXX:00402251  POP  EDI
  285. XXXX:00402252  POP  ESI
  286. XXXX:00402253  POP  EBX
  287. XXXX:00402254  ADD  ESP,00000800
  288. XXXX:0040225A  RET                                ;end of call 00402130
  289.  
  290. There is four comparasions:
  291.  
  292. XXXX:004021DA  MOVSX ESI,BYTE PTR [ESP+55]        ;(cmp ESI,08)
  293. XXXX:004021DF  MOVSX EDI,BYTE PTR [ESP+56]        ;(test EDI,EDI)
  294. XXXX:004021E4  MOVSX EBX,BYTE PTR [ESP+57]        ;(test EBX,EBX)
  295. XXXX:004021E9  MOVSX EBP,BYTE PTR [ESP+58]        ;(cmp EBP,05)
  296.  
  297. Finaly:
  298. 00000010 ** 08 00 00 05 ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??    ................
  299.  
  300.  
  301. ================================================
  302. 9. PART 06/17 - CALL 00402260 (en XXXX:00401C58)
  303. ================================================
  304.  
  305. The good way:
  306.  
  307. XXXX:00402597  MOV  DWORD PTR [0040D0B4],00000004 ;new icon
  308. XXXX:004025A1  XOR  EAX,EAX
  309. XXXX:004025A3  POP  EBP
  310. XXXX:004025A4  POP  EDI
  311. XXXX:004025A5  POP  ESI
  312. XXXX:004025A6  POP  EBX
  313. XXXX:004025A7  ADD  ESP,00000834
  314. XXXX:004025AD  RET                                ;end of call 00402260
  315.  
  316. There are 17 new bytes to find. Let introduce b0, b1b ..bG the 17 bytes to find.
  317. The crackme is expecting for:
  318.  
  319. b0 OR 56   ebx       =5E      |    b9 OR 53  [esp+24]  =7F
  320. b1 OR 49   [esp+10]  =4D      |    bA OR 20  [esp+28]  =63
  321. b2 OR 53   [esp+14]  =53      |    bB OR 53  [esp+2C]  =5B
  322. b3 OR 49   ebp       =5B      |    bC OR 49  [esp+30]  =4B
  323. b4 OR 54   esi       =5E      |    bD OR 54  [esp+34]  =7E
  324. b5 OR 20   edi       =32      |    bE OR 45  [esp+38]  =4F
  325. b6 OR 54   [esp+18]  =57      |    bF OR 21  [esp+40]  =65
  326. b7 OR 48   [esp+1C]  =5A      |    bG OR 21  [esp+44]  =75
  327. b8 OR 49   [esp+20]  =4B      |
  328.  
  329. In these cases, there are few good possibilities, i will choose one:
  330. (result XOR mask)
  331.  
  332. Result in the keyfile:
  333.  
  334. 00000010 ** ** ** ** ** 08 04 00-12 0A 12 03 12 02 2C 43    ..............,C
  335. 00000020 08 02 2A 0A 44 54 ?? ??-?? ?? ?? ?? ?? ?? ?? ??    ..*.DT..........
  336.  
  337.  
  338. =================================================
  339. 10. PART 07/17 - CALL 004025B0 (en XXXX:00401C6A)
  340. =================================================
  341.  
  342. The call uses the four following bytes:
  343.  
  344. 00000050 X1 X2 X3 X4 ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??    ................
  345.  
  346.  
  347. XXXX:004026EB  CMP  DWORD PTR [0040EA98],04       ;DWORD PTR [0040EA98] = 000000X2
  348. XXXX:004026F2  MOV  [0040EA9C],EAX
  349. XXXX:004026F7  JAE  0040271A
  350.  
  351. Then, a call GetLocalTime (uses the year). It makes a sort of sum (a checksum) with these four
  352. bytes. And compares it with 1999; i have not understand everything ;) Then:
  353.  
  354. XXXX:00402751  MOV  DWORD PTR [0040D0B4],00000005 ;nouvelle icone
  355. XXXX:0040275B  XOR  EAX,EAX
  356. ...
  357. XXXX:00402775  MOV  EAX,00000001
  358. XXXX:0040277A  POP  EDI
  359. XXXX:0040277B  POP  ESI
  360. XXXX:0040277C  ADD  ESP,00000814
  361. XXXX:00402782  RET                                ;end of call 004025B0
  362.  
  363. i put X1=X2=X3=X4=FF and it works.
  364.  
  365.  
  366. ===================================================
  367. 11. PARTIE 08/17 - CALL 00402790 (en XXXX:00401C7C)
  368. ===================================================
  369.  
  370. We must exit with EAX=1, it is very simple:
  371.  
  372. XXXX:0040283E  MOVSX EAX,BYTE PTR [ESP+00000091]  ;a char from the keyfile
  373. XXXX:00402846  MOVSX ECX,BYTE PTR [ESP+00000090]  ;another char from the keyfile
  374. XXXX:0040284E  ADD  ESP,04
  375. XXXX:00402851  MOV  [0040EA88],EAX
  376. XXXX:00402856  CMP  ECX,17
  377. XXXX:00402859  JA   00402884                      ;bad jump
  378. XXXX:0040285B  CMP  EAX,3B
  379. XXXX:0040285E  JA   00402884                      ;bad jump
  380. XXXX:00402860  MOV  DWORD PTR [0040D0B4],00000005 ;a new icon
  381. ...
  382. XXXX:0040287E  MOV  EAX,00000001
  383. XXXX:00402883  RET                                ;end of call 00402790
  384.  
  385. In the keyfile:
  386. 00000050 ** ** ** ** 17 3B ?? ??-?? ?? ?? ?? ?? ?? ?? ??    .....;..........
  387.  
  388.  
  389. =================================================
  390. 12. PART 09/17 - CALL 004028A0 (en XXXX:00401C8E)
  391. =================================================
  392.  
  393. XXXX:00402952  MOVSX EAX,SI                       ;SI=0001
  394. XXXX:00402958  MOV  CL,[EAX+0040D0FF]             ;datas
  395. XXXX:0040295E  CMP  [EAX+ESP+00000107],CL         ;compare with a byte in our keyfile
  396. XXXX:00402965  JNZ  00402987                      ;must be equal
  397. XXXX:00402967  INC  SI
  398. XXXX:00402969  CMP  SI,58                         ;58h = 88d
  399. XXXX:0040296D  JLE  0040294B                      ;loop
  400. XXXX:0040296F  MOV  DWORD PTR [0040D0B4],00000007 ;new icon
  401. XXXX:00402979  MOV  EAX,00000001
  402. XXXX:0040297E  POP  EDI
  403. XXXX:0040297F  POP  ESI
  404. XXXX:00402980  ADD  ESP,00000800
  405. XXXX:00402986  RET                                ;end of call 004028A0
  406.  
  407. We add in the keyfile:
  408.  
  409. 000000D0 53 55 50 50 4F 52 54 20-54 48 45 20 53 4F 46 54    SUPPORT THE SOFT
  410. 000000E0 57 41 52 45 20 41 55 54-48 4F 52 53 20 42 59 20    WARE AUTHORS BY 
  411. 000000F0 42 55 59 49 4E 47 20 54-48 45 20 50 52 4F 47 52    BUYING THE PROGR
  412. 00000100 41 4D 53 20 49 46 20 59-4F 55 20 55 53 45 20 54    AMS IF YOU USE T
  413. 00000110 48 45 4D 20 41 46 54 45-52 20 43 52 41 43 4B 49    HEM AFTER CRACKI
  414. 00000120 4E 47 20 54 48 45 4D 21-?? ?? ?? ?? ?? ?? ?? ??    NG THEM!........
  415.  
  416.  
  417. =================================================
  418. 13. PART 10/17 - CALL 004029A0 (en XXXX:00401C9C)
  419. =================================================
  420.  
  421. XXXX:00402A68  MOVSX EAX,SI
  422. XXXX:00402A6B  ADD  ESP,04
  423. XXXX:00402A6E  MOV  CL,[EAX+0040D1C7]             ;datas
  424. XXXX:00402A74  CMP  [EAX+ESP+00000187],CL         ;cmp with our keyfile
  425. XXXX:00402A7B  JNZ  00402AAC                      ;if jump = bad keyfile
  426. XXXX:00402A7D  INC  SI
  427. XXXX:00402A7F  MOV  EDI,0040D1C8                  ;datas, (about box, etc.)
  428. XXXX:00402A84  MOV  ECX,FFFFFFFF
  429. XXXX:00402A89  SUB  EAX,EAX
  430. XXXX:00402A8B  REPNZ SCASB                        ;string length
  431. XXXX:00402A8D  MOVSX EAX,SI
  432. XXXX:00402A90  NOT  ECX
  433. XXXX:00402A92  DEC  ECX
  434. XXXX:00402A93  CMP  ECX,EAX                       ;end of loop ?
  435. XXXX:00402A95  JAE  00402A61
  436. XXXX:00402A97  MOV  DWORD PTR [0040D0B4],00000008 ;new icon
  437. XXXX:00402AA1  XOR  EAX,EAX
  438. XXXX:00402AA3  POP  EDI
  439. XXXX:00402AA4  POP  ESI
  440. XXXX:00402AA5  ADD  ESP,00000800
  441. XXXX:00402AAB  RET                                ;end of call 004029A0
  442.  
  443. I add, some new bytes, in my keyfile:
  444.  
  445. 00000150 36 37 3C 3E 3E 32 54 4A-52 32 35 35 3C 35 3C 3A    67<>>2TJR255<5<;
  446. 00000160 37 32 3E 37 35 3C 38 ??-?? ?? ?? ?? ?? ?? ?? ??    72>75<8.........
  447.  
  448. These datas come directly from:
  449. [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion]
  450. "ProductId"="12799-OEM-0070752-92073"
  451.  
  452.  
  453. =================================================
  454. 14. PART 11/17 - CALL 00402AC0 (en XXXX:00401CAA)
  455. =================================================
  456.  
  457. The job: exit the call with EAX=1.
  458.  
  459. XXXX:00402B70  MOVSX EAX,CX                       ;at start CX=1
  460. XXXX:00402B73  INC  CX
  461. XXXX:00402B75  MOVSX EDX,BYTE PTR [EAX+ESP+3B]    ;beginning of the keyfile
  462. XXXX:00402B7A  ADD  EBX,EDX
  463. XXXX:00402B7C  CMP  CX,64                         ;64d = 100d
  464. XXXX:00402B80  JLE  00402B70                      ;loop
  465. XXXX:00402B82  XOR  EBX,000007CF
  466.  
  467. The (integer) division of ECX by 10 must be equal to the value of a specific byte from our
  468. keyfile. So EBX div 10 = 255 ( =FF, the maximum, otherwise it is more than 1 byte, so EBX don't
  469. have to be greater than 0x9FF). See remark below.
  470.  
  471. I fill my keyfile, to be all right.
  472.  
  473. XXXX:00402BA2  MOV  EAX,EBX                       ;sum of the 100 first characters
  474. XXXX:00402BA4  SUB  EDX,EDX
  475. XXXX:00402BA6  DIV  ECX                           ;ECX=0000000A
  476. XXXX:00402BA8  MOVSX ECX,BYTE PTR [ESP+000003EC]
  477. XXXX:00402BB0  MOV  [0040D1A8]
  478. XXXX:00402BB5  CMP  EAX,ECX                       ;cmp ZZ,EAX
  479. XXXX:00402BB7  JZ   00402BC5                      ;must be equal!
  480. ...
  481. XXXX:00402BC5  MOV  DWORD PTR [0040D0B4],00000009 ;new icon
  482. XXXX:00402BCF  MOV  EAX,00000001
  483. XXXX:00402BD4  POP  EDI
  484. XXXX:00402BD5  POP  ESI
  485. XXXX:00402BD6  POP  EBX
  486. XXXX:00402BD7  ADD  ESP,00000800
  487. XXXX:00402BDD  RET                                ;end of call 00402AC0
  488.  
  489. 000003B0 ZZ ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??    ................
  490.  
  491. ZZ= is the result (one byte) of the (integer) division (for me it is ZZ=3B)
  492.  
  493. Remark: ZZ=00 isn't a interressing value, i won't use it, let's suppose ZZ<>0
  494. Choose a byte between 10 et 7Fh=127d, because if for example you have ZZ=0xF0 then the instruction
  495. MOVSX ECX,F0 will have for result: ECX=FFFFFFF0.
  496. (be carefull MOVSX <> MOVZX) and if ZZ<0xA, we could not continue.
  497. My advise for choosing ZZ: a smal number!
  498.  
  499.  
  500. =================================================
  501. 15. PART 12/17 - CALL 00402BE0 (en XXXX:00401CB8)
  502. =================================================
  503.  
  504. We must exit the call with EAX=1, this call is a sort of addon of the previous call.
  505.  
  506. XXXX:00402CD2  DIV  ECX                           ;ECX=54, do ZZ▓ DIV ECX
  507. XXXX:00402CD4  MOVSX EDX,BYTE PTR [ESP+000003ED]  ;read a char from the keyfile
  508. XXXX:00402CDC  MOV  [0040D1AC],EAX                ;YY
  509. XXXX:00402CE1  CMP  EDX,EAX                       ;we must have EAX=EDX
  510. XXXX:00402CE3  JZ   00402CF1
  511. ...
  512. XXXX:00402CF1  MOV  DWORD PTR [0040D0B4],0000000A ;new icon, the 10th!
  513. XXXX:00402CFB  MOV  EAX,00000001
  514. XXXX:00402D00  POP  EDI
  515. XXXX:00402D01  POP  ESI
  516. XXXX:00402D02  POP  EBX
  517. XXXX:00402D03  ADD  ESP,00000800
  518. XXXX:00402D09  RET                                ;end of call 00402BE0
  519.  
  520. 000003B0 ZZ YY ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??    ................
  521.  
  522. YY = ZZ▓ div 54 (YY and ZZ are two bytes, and ZZ>9 (9h*9h=51h) )
  523.  
  524. Remaque: YY=00 isn't a interressing value, i won't use it, let's suppose YY<>0.
  525.          we must have (ZZ▓ div 54) > YY
  526.  
  527.  
  528. =================================================
  529. 16. PART 13/17 - CALL 00402D10 (en XXXX:00401CC6)
  530. =================================================
  531.  
  532. XXXX:00402DFD  MOVSX ECX,BYTE PTR [EAX+ESP+3B]    ;the beginning of the keyfile
  533. XXXX:00402E02  ADD  ESI,ECX                       ;at start: esi=0
  534. XXXX:00402E04  INC  EAX                           ;at start: eax=0
  535. XXXX:00402E05  CMP  EAX,00000180                  ;180h = 384d
  536. XXXX:00402E0A  JBE  00402DFD                      ;loop
  537. XXXX:00402E0C  MOV  EDI,EAX
  538. ...
  539. XXXX:00402E1A  IMUL EAX,EDI                       ;YY*ZZ
  540. XXXX:00402E1D  XOR  EAX,ESI                       ;esi sum of the first 384 chars = SUM
  541. XXXX:00402E1F  MOV  ECX,00000216
  542. XXXX:00402E24  SUB  EDX,EDX                       ;xor edx,edx
  543. XXXX:00402E26  DIV  ECX
  544. XXXX:00402E28  MOVSX EDX,BYTE PTR [ESP+000003EE]
  545. XXXX:00402E30  MOV  [0040D1B0],EAX                ;TT
  546. XXXX:00402E35  CMP  EDX,EAX                       ;cmp TT,EAX
  547. XXXX:00402E37  JZ   00402E45
  548.  
  549. 000003B0 ZZ YY TT ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??    ................
  550.  
  551. XXXX:00402E45  MOV  DWORD PTR [0040D0B4],0000000B ;still a new icon
  552. XXXX:00402E4F  MOV  EAX,00000001
  553. XXXX:00402E54  POP  EDI
  554. XXXX:00402E55  POP  ESI
  555. XXXX:00402E56  POP  EBX
  556. XXXX:00402E57  ADD  ESP,00000800
  557. XXXX:00402E5D  RET                                ;end of call 00402D10
  558.  
  559. Remark: if we want TT<>0, we must have:
  560.           ( (YY*ZZ) XOR SUM ) div 216 = TT  with  TT > YY
  561.  
  562. The icon is smiling!
  563.  
  564.  
  565. =================================================
  566. 17. PART 14/17 - CALL 00402E60 (en XXXX:00401CD4)
  567. =================================================
  568.  
  569. This call use the three previous result.
  570.  
  571. XXXX:00402F07  MOV  EAX,[0040D1B0]                ;TT
  572. XXXX:00402F0C  MOV  ECX,[0040D1AC]                ;YY
  573. XXXX:00402F12  MOV  ESI,[0040D1A8]                ;ZZ
  574. ...
  575. [...]
  576. ...
  577. XXXX:00402F38  MOVSX EDX,BYTE PTR [ESP+000003EB]
  578. XXXX:00402F40  MOV  [040D1B4],EAX                 ;UU
  579. XXXX:00402F45  CMP  EDX,EAX
  580. XXXX:00402F47  JZ   00402F54
  581.  
  582. What'is doing [...]?
  583. We must have: (TT div YY)*(ZZ div YY)*(TT+YY+ZZ) <> 0  ===> TT > YY et ZZ > YY
  584.  
  585. XXXX:00402F54  MOV  DWORD PTR [0040D0B4],0000000C
  586. XXXX:00402F5E  MOV  EAX,00000001
  587. XXXX:00402F63  POP  EDI
  588. XXXX:00402F64  POP  ESI
  589. XXXX:00402F65  ADD  ESP,00000800
  590. XXXX:00402F6B  RET                                ;end of call 00402E60
  591.  
  592.  
  593. =================================================
  594. 18. PART 15/17 - CALL 00402F70 (en XXXX:00401CE2)
  595. =================================================
  596.  
  597. This call uses the loop "180h" (see above, chapter 16.)
  598.  
  599. XXXX:0040303B  DIV  ECX                          ;ECX=1F4
  600. XXXX:0040303D  MOVSX EDX,BYTE PTR [ESP+000003F0] ;from the keyfile
  601. XXXX:00403045  MOV  [0040D1B8],EAX               ;VV
  602. XXXX:0040304C  JZ   0040305D                     ;we must jump
  603. ...
  604. XXXX:0040305D  MOV  DWORD PTR [0040D0B4],000000D
  605. XXXX:00403067  XOR  EAX,EAX
  606. XXXX:00403069  POP  EDI
  607. XXXX:0040306A  POP  ESI
  608. XXXX:0040306B  POP  EBX
  609. XXXX:0040306C  ADD  ESP,00000800
  610. XXXX:00403072  RET                               ;end of call 00402F70
  611.  
  612.  
  613. =================================================
  614. 19. PART 16/17 - CALL 00403080 (en XXXX:00401CF0)
  615. =================================================
  616.  
  617.  
  618. XXXX:00403127  MOV  ECX,[0040D1B8]                 ;VV
  619. XXXX:0040312D  ADD  ECX,[0040D1B4]                 ;UU
  620. XXXX:00403133  ADD  ECX,[0040D1B0]                 ;TT
  621. XXXX:00403139  ADD  ECX,[0040D1AC]                 ;YY
  622. XXXX:0040313F  ADD  ECX,[0040D1A8]                 ;ZZ
  623. XXXX:00403145  MOV  [ESP+18],ECX                   ;for me i have: DA
  624. XXXX:00403149  MOV  DWORD PTR [ESP+1C],00000000
  625. XXXX:00403151  MOV  QWORD PTR [ESP+18]             ;on 64 bits
  626. XXXX:00403155  FSQRT                               ;square root (co-processor instruction)
  627. XXXX:00403157  CALL 0040420C                       ;result in EAX
  628. XXXX:0040315C  MOVSX ECX,BYTE PTR [ESP+000003ED]
  629. XXXX:00403164  CMP  EAX,ECX
  630. XXXX:00403166  JZ   00403173
  631. ...
  632. XXXX:00403173  MOV  DWORD PTR [0040D0B4],0000000E
  633. XXXX:0040317D  MOV  EAX,00000001
  634. XXXX:00403182  POP  EDI
  635. XXXX:00403183  POP  ESI
  636. XXXX:00403184  ADD  ESP,00000800
  637. XXXX:0040318A  RET                                 ;end of call 00403080
  638.  
  639. An example: 0xDA = 218 and, sqrt(218)=14.7648... i round this to 14 (floor value):
  640. 0xE, it is the result found in EAX.
  641.  
  642.  
  643. Last icon!!!
  644.  
  645.  
  646. =================================================
  647. 20. PART 17/17 - CALL 00403080 (en XXXX:00401CF0)
  648. =================================================
  649.  
  650. Last call, it's simple, it checks if the last character of the keyfile is "R".
  651.  
  652. XXXX:00403237  CMP  BYTE PTR [ESP+00000437],52     ;52 ("R")
  653. XXXX:0040323F  JZ   0040324C
  654. ...
  655. XXXX:0040324C  MOV  DWORD PTR [0040D0B4],0000000F
  656. XXXX:00403256  MOV  EAX,00000001
  657. XXXX:0040325B  POP  EDI
  658. XXXX:0040325C  POP  ESI
  659. XXXX:0040325D  ADD  ESP,00000800
  660. XXXX:00403263  RET                                 ;end of call 00403080
  661.  
  662. The end!!!!!!!!!!
  663.  
  664. ==============
  665. 21. CONCLUSION
  666. ==============
  667.  
  668. It took me a lot of time, to understand that the name was written at offset 9A (the 9Bth byte of
  669. the keyfile) and must be ended by a null byte. Otherwise, you will have some problems!!!
  670. In the call:
  671. 4. THE SURPRISE!
  672. 12. PART 09/17 - CALL 004028A0 (en XXXX:00401C8E)
  673. 13. PART 10/17 - CALL 004029A0 (en XXXX:00401C9C)
  674.  
  675. This crackme is hard, but there are a lot a working keyfile.
  676.  
  677. Lucifer48 (lucifer48@yahoo.com), 27 may 1999
  678.  
  679. PS: When i thought again about it, it seems strange that we could manipulate the overflow of the
  680. stack, with a high-level language (such as C++). The instruction REPNZ SCASB should put me on the
  681. right way earlier. (on the beginning, i filled my keyfile with 33 bytes!!! ).
  682.  
  683.